import 'package:dk_flutter_base/dk_ui.dart';
import 'package:dk_flutter_base/dk_core.dart';

class SectionWidget extends StatelessWidget {
  //主标题
  final String title;
  //副标题
  final String subTitle;
  final bool bottomLineHidden;
  final String getPasswordText;
  final VoidCallback tapAction;
  final bool canAdd;//是否可以添加视频
  final TextStyle titleStyle;
  SectionWidget(
      {this.title = "",
        this.canAdd = false,
      this.subTitle = "",
      this.bottomLineHidden = true,
      this.getPasswordText = "",
        this.tapAction,
        this.titleStyle,
      });
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: Row(
        children: <Widget>[
          SizedBox(
            width: 16,
            height: 0,
          ),
          Expanded(
            child: Container(
              child: Row(
                children: <Widget>[
                  Expanded(
                    child: Container(
                      //color: Colors.green,
                      child: Padding(
                        padding: EdgeInsets.only(top: 13,bottom: 13),
                        child: Text(
                          this.title,
                          style: objEmpty(this.titleStyle) ? TextStyle(
                              color: Color(0xFF666666),
                              fontSize: 16,
                              fontWeight: FontWeight.w600) : this.titleStyle,
                          softWrap: true,
                        ),
                      ),
                    ),
                  ),
                  Opacity(
                    opacity: stringNotEmpty(this.subTitle) ? 1 : 0,
                    child: Padding(
                      padding: const EdgeInsets.only(left: 5),
                      child: Text(
                        this.subTitle,
                        style:
                            TextStyle(color: Color(0xFF999999), fontSize: 14),
                      ),
                    ),
                  ),
                  Expanded(
                      child: GestureDetector(
                        onTap: (){
                          if(this.canAdd) {
                            this.tapAction();
                          }
                        },
                        child: Container(
                          padding: EdgeInsets.only(top: 13,bottom: 13),
                          child: Align(
                            alignment:Alignment.centerRight ,
                            child: Text(this.getPasswordText,style: TextStyle(
                                color: Color(0xFF3DBCC6),
                                fontSize: 13
                            ),),
                          ),
                        ),
                      ))
                ],
              ),
              decoration: BoxDecoration(
                  border: this.bottomLineHidden
                      ? null
                      : Border(
                          bottom: Divider.createBorderSide(context,
                              color: Color(0xFFEBEBEB), width: 0.5))),
            ),
          ),
          SizedBox(
            width: 17,
            height: 0,
          )
        ],
      ),
    );
  }
}
